import fetch from 'common/src/utils/fetch'
import UTILS from "common/src/utils/utils";
/**
 * 查询学生绩点列表
 * params {data: {}} 查询条件
 */
function queryStudentsGradePointList(data) {
    return fetch({
        url: '/api/scoremanagementservice/studentGradePointController/queryStudentsGradePointList',
        method: 'post',
        data
    });
}
/**
 * 查询学生绩点详情
 * params {studentId : String} 学生学号
 */

function queryStudentGradePointDetailInfo(studentId) {
    return fetch({
        url: `/api/scoremanagementservice/studentGradePointController/queryStudentGradePointDetailInfo?studentId=${studentId}`,
        method: 'post'
    });
}
/**
 * 导出学生绩点列表
 *  params {data :{}} 页面筛选项+勾选项
 */
function exportStudentsGradePointList(data) {
    return fetch({
        url: '/api/scoremanagementservice/studentGradePointController/exportStudentsGradePointList',
        method: 'post',
        responseType: 'blob',
        data: data
    }).then(res => {
        UTILS.downloadFile(res, '学生绩点导出.xls', 'application/vnd.ms-excel;charset=utf-8');
    });
}

/**
 * 导出学生绩点详情
 * params {studentId :String ,language:String }
 */

function exportStudentGradePointDetailPdf(studentId,language) {
    window.location.href =  `/api/scoremanagementservice/studentGradePointController/exportStudentGradePointDetailPdf?studentId=${studentId}&&language=${language}`
}

function exportList(data){//按比例导出
    return fetch ({
        url:`/api/scoremanagementservice/studentGradePointController/exportStudentsGradePointList`,
        method:'post',
        data,
    })
}

function downStatus(key){//导出
    return fetch ({
        url:`/api/scoremanagementservice/studentGradePointController/queryExportProgressByKey?key=${key}`,
        method:'get',
    })
}
export default{
    queryStudentsGradePointList,
    queryStudentGradePointDetailInfo,
    exportStudentsGradePointList,
    exportStudentGradePointDetailPdf,
    exportList,
    downStatus
}